home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / nslookup / res.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-23  |  3.5 KB  |  129 lines

  1. /*
  2.  * Copyright (c) 1985 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  *    @(#)res.h    5.6 (Berkeley) 7/23/88
  18.  */
  19.  
  20. /*
  21.  *******************************************************************************
  22.  *
  23.  *  res.h --
  24.  *
  25.  *    Definitions used by modules of the name server lookup program.
  26.  *
  27.  *    Copyright (c) 1985 
  28.  *      Andrew Cherenson
  29.  *    U.C. Berkeley
  30.  *      CS298-26  Fall 1985
  31.  *  
  32.  *******************************************************************************
  33.  */
  34.  
  35. #define TRUE    1
  36. #define FALSE    0
  37. typedef int Boolean;
  38.  
  39. /*
  40.  *  Define return statuses in addtion to the ones defined in namserv.h
  41.  *   let SUCCESS be a synonym for NOERROR
  42.  *
  43.  *    TIME_OUT    - a socket connection timed out.
  44.  *    NO_INFO        - the server didn't find any info about the host.
  45.  *    ERROR        - one of the following types of errors:
  46.  *               dn_expand, res_mkquery failed
  47.  *               bad command line, socket operation failed, etc.
  48.  *    NONAUTH        - the server didn't have the desired info but
  49.  *              returned the name(s) of some servers who should.
  50.  *
  51.  */
  52.  
  53. #define  SUCCESS        0
  54. #define  TIME_OUT        -1
  55. #define  NO_INFO         -2
  56. #define  ERROR             -3
  57. #define  NONAUTH         -4
  58.  
  59. /*
  60.  *  Define additional options for the resolver state structure.
  61.  *
  62.  *   RES_DEBUG2        more verbose debug level 
  63.  */
  64.  
  65. #define RES_DEBUG2    0x80000000
  66.  
  67. /*
  68.  *  Maximum length of server, host and file names.
  69.  */
  70.  
  71. #define NAME_LEN 80
  72.  
  73.  
  74. /*
  75.  * Modified struct hostent from <netdb.h>
  76.  *
  77.  * "Structures returned by network data base library.  All addresses
  78.  * are supplied in host order, and returned in network order (suitable
  79.  * for use in system calls)."
  80.  */
  81.  
  82. typedef struct    {
  83.     char    *name;        /* official name of host */
  84.     char    **domains;    /* domains it serves */
  85.     char    **addrList;    /* list of addresses from name server */
  86. } ServerInfo;
  87.  
  88. typedef struct    {
  89.     char    *name;        /* official name of host */
  90.     char    **aliases;    /* alias list */
  91.     char    **addrList;    /* list of addresses from name server */
  92.     int    addrType;    /* host address type */
  93.     int    addrLen;    /* length of address */
  94.     ServerInfo **servers;
  95. } HostInfo;
  96.  
  97.  
  98. /*
  99.  *  SockFD is the file descriptor for sockets used to connect with
  100.  *  the name servers. It is global so the Control-C handler can close
  101.  *  it. Likewise for filePtr, which is used for directing listings
  102.  *  to a file.
  103.  */
  104.  
  105. extern int sockFD;
  106. extern FILE *filePtr;
  107.  
  108.  
  109. /*
  110.  *  External routines:
  111.  */
  112.  
  113. extern int   Print_query();
  114. extern char *Print_cdname();
  115. extern char *Print_cdname2();    /* fixed width */
  116. extern char *Print_rr();
  117. extern char *DecodeType();    /* descriptive version of p_type */
  118. extern char *DecodeError();
  119. extern char *Calloc();
  120. extern char *Malloc();
  121. extern void NsError();
  122. extern void PrintServer();
  123. extern void PrintHostInfo();
  124. extern void ShowOptions();
  125. extern void FreeHostInfoPtr();
  126. extern FILE *OpenFile();
  127. extern char *inet_ntoa();
  128. extern char *res_skip();
  129.